package com.example.controller;

import com.example.entity.FacilityPublic;
import com.example.entity.Page.PageRequest;
import com.example.result.CommonResult;
import com.example.service.FacilityPublicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: tobed
 * @date: 2022/11/14
 * @time: 8:23
 */
@RestController
@RequestMapping("FacilityPublic")
public class FacilityPublicController {

    @Autowired
    FacilityPublicService facilityPublicService;

    /*公共设备全查*/
    @RequestMapping("list")
    public CommonResult list(FacilityPublic facilityPublic, PageRequest pageRequest){
        System.out.println(facilityPublic);
        System.out.println(pageRequest);
        CommonResult commonResult = facilityPublicService.list(facilityPublic,pageRequest);
        return commonResult;
    }

    /*添加公共设备*/
    @PostMapping("createFacility")
    public CommonResult createFacility(@RequestBody FacilityPublic facilityPublic){
        CommonResult commonResult = facilityPublicService.createFacility(facilityPublic);
        return commonResult;
    }

    /*修改公共设备信息*/
    @PostMapping("update")
    public CommonResult update(@RequestBody FacilityPublic facilityPublic){
        CommonResult commonResult = facilityPublicService.update(facilityPublic);
        return commonResult;
    }

    /*删除设备*/
    @PostMapping("remove/{id}")
    public CommonResult remove(@PathVariable Integer id){
        CommonResult commonResult = facilityPublicService.remove(id);
        return commonResult;
    }


}
